const path = require('path');
const webpack = require('webpack'); 
const CleanWebpackPlugin = require('clean-webpack-plugin');//清除多余文件
const { dir } = require('console');

module.exports = {
     
    entry: {
        index: './script/modules/common/views/manager_content.js'
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'build')
    },
    module: {
        rules: [{
            test: /\.css$/,
            use: [ {
                loader: 'style-loader'
                 },
                 {loader: 'css-loader'}
            ]
            
        }, {
            test: /\.scss$/,
            use: [ {
                loader: 'style-loader'
                 },
                 {loader: 'css-loader'},
                 {loader: 'sass-loader'}
            ]
            
        }, {
            test: /\.(png|svg|jpg|gif)$/,
            use: [ {
                loader: 'url-loader',
                options: {
                    limit: 10000,
                    name: 'img/[name].[hash:7].[ext]'
                }
                 },
                  
            ]
             
        }, {
            test: /\.(js|jsx)$/,
            use: {
                loader: 'babel-loader'},
            exclude: /node_modules/
        }]
    },
    devServer: {
        contentBase: './build',
        port: 8081,
        inline: true,
        hot: true
    },
    // externals: [nodeExternals()],
    plugins: [
        new webpack.HotModuleReplacementPlugin() 
         
    ],
    //其他解决方案配置
    resolve: {
        extensions: [ '.js', '.json', '.css', '.scss'] 
 
    }
 
};